<template>
  <div class="channel-page">
    <h1 class="page-title">视频频道分类</h1>
    <div class="channel-grid">
      <div
        class="channel-item"
        v-for="(tag, index) in channelTags"
        :key="index"
        :style="{ backgroundImage: `url(${tag.cover})` }"
        @click="playVideo"
      >
        <div class="channel-tag">#{{ tag.tag }}#</div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const channelTags = ref([
  {
    "tag": "创意",
    "cover": "https://images.unsplash.com/photo-1504868584819-f8e8b4b6d7e3?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "剧情",
    "cover": "https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "动画",
    "cover": "https://images.unsplash.com/photo-1635070041078-e363dbe005cb?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "励志",
    "cover": "https://images.unsplash.com/photo-1494172961521-33799ddd43a5?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "实验",
    "cover": "https://images.unsplash.com/photo-1518770660439-4636190af475?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "广告",
    "cover": "https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "搞笑",
    "cover": "https://images.unsplash.com/photo-1544161515-4ab6ce6db874?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "旅行",
    "cover": "https://images.unsplash.com/photo-1520250497591-112f2f40a3f4?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "时尚",
    "cover": "https://images.unsplash.com/photo-1483985988355-763728e1935b?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "汽车",
    "cover": "https://images.unsplash.com/photo-1492144534655-ae79c964c9d7?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "混剪",
    "cover": "https://images.unsplash.com/photo-1559703248-857ea4e6227a?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "游戏",
    "cover": "https://images.unsplash.com/photo-1493711662062-fa541adb3fc8?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "爱情",
    "cover": "https://images.unsplash.com/photo-1529333166437-7750a6dd5a70?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "生活",
    "cover": "https://images.unsplash.com/photo-1504674900247-0877df9cc836?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "科幻",
    "cover": "https://images.unsplash.com/photo-1534796636912-3b95b3ab5986?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "纪录",
    "cover": "https://images.unsplash.com/photo-1470115636492-6d2b56f9146d?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "美食",
    "cover": "https://images.unsplash.com/photo-1504674900247-0877df9cc836?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "运动",
    "cover": "https://images.unsplash.com/photo-1571019613454-1cb2f99b2d8b?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "音乐",
    "cover": "https://images.unsplash.com/photo-1501612780327-45045538702b?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  },
  {
    "tag": "预告",
    "cover": "https://images.unsplash.com/photo-1517604931442-7e0c8ed2963c?ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=80"
  }
])

// 固定的腾讯视频链接
const videoUrl = 'https://v.qq.com/x/cover/mzc00200mp8er9b.html'

const playVideo = () => {
  window.open(videoUrl, '_blank')
}
</script>

<style scoped>
.channel-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  text-align: center;
  margin-bottom: 30px;
  color: #333;
  font-size: 2rem;
  font-weight: 600;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.channel-item {
  height: 150px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer; /* 添加指针样式 */
}

.channel-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease;
}

.channel-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.channel-item:hover::before {
  background: rgba(0, 0, 0, 0.5);
}

.channel-tag {
  position: relative;
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
  z-index: 1;
  padding: 8px 16px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.channel-item:hover .channel-tag {
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .channel-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .channel-item {
    height: 120px;
  }
  
  .channel-tag {
    font-size: 1.2rem;
  }
}
</style>